package ui;

/**
 * JPanel AddAccount
 * 
 * @author XA9
 * 
 */

import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.JTextField;

public class AddAccount extends JPanel {
	private JLabel lblAddCustomer;
	private JLabel lblXA9;
	private JLabel lblLogo;
	private JButton btnReturn;
	private JTextField tfAccountName;
	private JTextField tfBalance;
	private JTextField tfLoginId;
	private JTextField tfAccountnumber;
	private JLabel lblAccountname;
	private JLabel lblBalance;
	private JLabel lblCustomerLoginId;
	private JLabel lblAccountnumber;
	private JButton btnAddAccount;
	private JTextField tfRate;
	private JLabel lblRate;
	private JLabel lblPleaseEnterDetails;

	/**
	 * Create the panel.
	 */
	public AddAccount() {
		setBackground(UIManager.getColor("Label.background"));
		setLayout(null);

		lblAddCustomer = new JLabel("Add new account");
		lblAddCustomer.setOpaque(true);
		lblAddCustomer.setBackground(UIManager.getColor("Label.background"));
		lblAddCustomer.setHorizontalAlignment(SwingConstants.CENTER);
		lblAddCustomer.setForeground(UIManager.getColor("menuText"));
		lblAddCustomer.setFont(new Font("Eurostile", Font.BOLD, 22));
		lblAddCustomer.setBounds(0, 94, 735, 28);
		add(lblAddCustomer);

		lblXA9 = new JLabel("\u00A92013 CBS HA.IT (Gruppe XA-9)\t\t ");
		lblXA9.setForeground(UIManager.getColor("Button.darkShadow"));
		lblXA9.setBackground(UIManager.getColor("Button.darkShadow"));
		lblXA9.setHorizontalAlignment(SwingConstants.CENTER);
		lblXA9.setFont(new Font("Eurostile", Font.PLAIN, 11));
		lblXA9.setBounds(0, 550, 735, 50);
		add(lblXA9);

		btnReturn = new JButton("Return to main menu");
		btnReturn.setFont(new Font("Eurostile", Font.PLAIN | Font.BOLD, 13));
		btnReturn.setForeground(UIManager.getColor("CheckBox.select"));
		btnReturn.setBounds(190, 362, 185, 45);
		add(btnReturn);

		lblLogo = new JLabel("");
		lblLogo.setIcon(new ImageIcon(
				"/Users/martinotto-sidelmann/Desktop/Zombium.png"));
		lblLogo.setBounds(530, 12, 200, 70);
		add(lblLogo);

		tfAccountName = new JTextField();
		tfAccountName.setToolTipText("Add name for account ");
		tfAccountName.setFont(new Font("Eurostile", Font.PLAIN, 13));
		tfAccountName.setBounds(190, 165, 185, 33);
		add(tfAccountName);
		tfAccountName.setColumns(10);

		tfBalance = new JTextField();
		tfBalance.setToolTipText("Add balance to account (e.g. 1000.00).");
		tfBalance.setFont(new Font("Eurostile", Font.PLAIN, 13));
		tfBalance.setColumns(10);
		tfBalance.setBounds(405, 165, 185, 33);
		add(tfBalance);

		tfLoginId = new JTextField();
		tfLoginId
				.setToolTipText("Add existing loginid to assign account to existing customer");
		tfLoginId.setFont(new Font("Eurostile", Font.PLAIN, 13));
		tfLoginId.setColumns(10);
		tfLoginId.setBounds(405, 210, 185, 33);
		add(tfLoginId);

		tfAccountnumber = new JTextField();
		tfAccountnumber
				.setToolTipText("Add accountnumber to account (e.g. 111121).");
		tfAccountnumber.setFont(new Font("Eurostile", Font.PLAIN, 13));
		tfAccountnumber.setColumns(10);
		tfAccountnumber.setBounds(190, 210, 185, 33);
		add(tfAccountnumber);

		lblAccountname = new JLabel("Accountname:");
		lblAccountname.setToolTipText("");
		lblAccountname.setFont(new Font("Eurostile", Font.BOLD, 13));
		lblAccountname.setBounds(193, 145, 200, 33);
		add(lblAccountname);

		lblBalance = new JLabel("Balance:");
		lblBalance.setFont(new Font("Eurostile", Font.BOLD, 13));
		lblBalance.setBounds(408, 145, 200, 33);
		add(lblBalance);

		lblCustomerLoginId = new JLabel("Customer LoginId:");
		lblCustomerLoginId.setFont(new Font("Eurostile", Font.BOLD, 13));
		lblCustomerLoginId.setBounds(408, 190, 200, 33);
		add(lblCustomerLoginId);

		lblAccountnumber = new JLabel("Accountnumber:");
		lblAccountnumber.setFont(new Font("Eurostile", Font.BOLD, 13));
		lblAccountnumber.setBounds(193, 190, 200, 33);
		add(lblAccountnumber);

		btnAddAccount = new JButton("Add account");
		btnAddAccount.setFont(new Font("Eurostile", Font.BOLD, 13));
		btnAddAccount.setBounds(405, 255, 185, 45);
		add(btnAddAccount);

		tfRate = new JTextField();
		tfRate.setToolTipText("Add rate to account (e.g. 1.02).");
		tfRate.setText(" ");
		tfRate.setFont(new Font("Eurostile", Font.PLAIN, 13));
		tfRate.setColumns(10);
		tfRate.setBounds(190, 255, 185, 33);
		add(tfRate);

		lblRate = new JLabel("Rate:");
		lblRate.setFont(new Font("Eurostile", Font.BOLD, 13));
		lblRate.setBounds(193, 235, 200, 33);
		add(lblRate);

		lblPleaseEnterDetails = new JLabel(
				"Please enter details to add account");
		lblPleaseEnterDetails.setHorizontalAlignment(SwingConstants.CENTER);
		lblPleaseEnterDetails.setForeground(Color.BLACK);
		lblPleaseEnterDetails.setFont(new Font("Eurostile", Font.PLAIN, 15));
		lblPleaseEnterDetails.setBounds(0, 122, 735, 16);
		add(lblPleaseEnterDetails);

	}

	/**
	 * Returns text from JTextfield tfAccountName
	 * 
	 * @return String accountname
	 */
	public String getTfAccountName() {
		return tfAccountName.getText();
	}

	/**
	 * Returns text from JTextfield tfAccounNumber
	 * 
	 * @return String accountnumber
	 */
	public String getTfAccountNumber() {
		return tfAccountnumber.getText();
	}

	/**
	 * Returns text from JTextfield tfRate
	 * 
	 * @return String rate
	 */
	public String getTfRate() {
		return tfRate.getText();
	}

	/**
	 * Returns text from JTextfield tfLoginId
	 * 
	 * @return String loginid
	 */
	public String getTfLoginId() {
		return tfLoginId.getText();
	}

	/**
	 * Returns text from JTextfield tfBalance
	 * 
	 * @return String balance
	 */
	public String getTfBalance() {
		return tfBalance.getText();
	}

	/**
	 * Returns JButton
	 * 
	 * @return btnReturn
	 */
	public JButton getBtnReturn() {
		return btnReturn;
	}

	/**
	 * Returns JButton
	 * 
	 * @return btnAddAccount
	 */
	public JButton getBtnAddAccount() {
		return btnAddAccount;
	}

	/**
	 * Clear fields of JTextfields
	 * 
	 */
	public void clearFields() {
		tfAccountName.setText("");
		tfBalance.setText("");
		tfAccountnumber.setText("");
		tfLoginId.setText("");
		tfRate.setText("");
	}

	/**
	 * Add ActionListener to JButtons
	 * 
	 * @param ActionListener l
	 * 
	 */
	public void addActionListener(ActionListener l) {
		btnReturn.addActionListener(l);
		btnAddAccount.addActionListener(l);

	}
}
